<template>
    <div class="w100p fullbg">
        <div class="_container_ clearfix pt46">
            <!--导航-->
            <ChildrenRouter :routers="navs"
                            class="fl"
                            :active_router="active_router"
                            @handleClose="handleClose"
                            @handleOpen="handleOpen"
            ></ChildrenRouter>
            <!--内容-->
            <div class="w82_5p bgfff fr minh814 postionre pb120">
                <Title :links="links"></Title>
                <transition name="fade" mode="out-in">
                    <router-view/>
                </transition>

            </div>
        </div>
    </div>
</template>

<script>
    import ChildrenRouter from './../components/ChildrenRouter'
    import Title from './../components/commons/Title'
    export default {
        name: "Profile",
        components:{ChildrenRouter,Title},
        data(){
            return{
                navs:{
                    title:'公司简介',
                    childrens:[
                        {text : '交易介绍', link:'/profile/introduction'},
                        {text : '企业文化', link:'/profile/culture'},
                        {text : '企业荣誉', link:'/profile/honor'},
                        {text : '人才招聘', link:'/profile/invite'},
                    ]
                },
                links:{
                    two:{text:'公司简介',link:'/information/zhibo'},
                    three:{text:'交易介绍',link:''},
                    four:''
                },
                active_router:'/profile/introduction'
            }
        },
        created(){
            var v = this , _path = '';
            _path = this.$route.path;
            if(_path == '/profile/introduction'){
                v.links.three = v.navs.childrens[0];
            }else if(_path == '/profile/culture'){
                v.links.three = v.navs.childrens[1];
            }else if(_path == '/profile/honor'){
                v.links.three = v.navs.childrens[2];
            }else if(_path == '/profile/invite'){
                v.links.three = v.navs.childrens[3];
            }
            v.active_router = v.links.three.link;
        },
        watch:{
            '$route'(to,from){
                var v = this , _path = '';
                _path = to.path;
                if(_path == '/profile/introduction'){
                    v.links.three = v.navs.childrens[0];
                }else if(_path == '/profile/culture'){
                    v.links.three = v.navs.childrens[1];
                }else if(_path == '/profile/honor'){
                    v.links.three = v.navs.childrens[2];
                }else if(_path == '/profile/invite'){
                    v.links.three = v.navs.childrens[3];
                }
                v.active_router = v.links.three.link;
             /*   if(to.matched[0].path=='/profile'){
                    if(to.query.i>=0){
                        return
                    }
                    v.links.four = '';
                }*/
            }
        },
        methods:{
            handleOpen(key,keypath){
                this.rooterChange(key);
            },
            handleClose(key,keypath){
                this.rooterChange(key);
                // console.log(key,keypath)
            },
            rooterChange(key){
                var _path = this.navs.childrens[key].link;
                this.links.three = this.navs.childrens[key];
                this.active_router = this.links.three.link;
                this.$router.push(_path);
            },
           /* detailTap(index){
                this.$router.push({path:this.links.three.link,query:{i:index}});
                this.links.four = {text:'详情',link:''};
            }*/
        }
    }
</script>

<style>

</style>








































